﻿Imports System.ComponentModel
Imports DevExpress.Skins
Imports DevExpress.LookAndFeel
Imports DevExpress.UserSkins
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.XtraBars.Helpers
Imports DevExpress.XtraSplashScreen
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo

Public Class KH_TheKho
    Private inplaceEditor As BaseEdit
    Private Sub KH_TonKho_Load(sender As Object, e As EventArgs) Handles Me.Load
        'load tháng hiện tại
        Me.TuNgayIDateEdit.EditValue = getNgayDauThang(Today)
        Me.DenNgayIDateEdit.EditValue = getNgayCuoiThang(Today)

        Me.GetTCTonKho_TheKho_TheoLo_HanDungTableAdapter.Fill(Me.PCV_FISHDataSet.getTCTonKho_TheKho_TheoLo_HanDung, getRecycleId(CDate(Me.TuNgayIDateEdit.EditValue)))
    End Sub
    Private Sub DrillDown()
        Try
            Dim ma As String = Me.IGridView1.GetFocusedRowCellValue("ma")
            If ma.Substring(0, 4) = "BHNN" Then
                BH_BanHangNuocNgoai1.setMa(ma)
                BH_BanHangNuocNgoai1.Show()
                BH_BanHangNuocNgoai1.MdiParent = Me.MdiParent
                BH_BanHangNuocNgoai1.WindowState = FormWindowState.Maximized
            ElseIf ma.Substring(0, 4) = "MHNN" Then
                MH_MuaHangNuocNgoai1.setMa(ma)
                MH_MuaHangNuocNgoai1.Show()
                MH_MuaHangNuocNgoai1.MdiParent = Me.MdiParent
                MH_MuaHangNuocNgoai1.WindowState = FormWindowState.Maximized
            End If
        Catch ex As Exception

        End Try
    End Sub
    Private Sub MởPhiếuToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MởPhiếuToolStripMenuItem.Click
        DrillDown()
    End Sub

    Private Sub IGridView1_DoubleClick(sender As Object, e As EventArgs) Handles IGridView1.DoubleClick
        Dim view As GridView = CType(sender, GridView)
        Dim pt As Point = view.GridControl.PointToClient(Control.MousePosition)
        DoRowDoubleClick(view, pt)
    End Sub

    Private Sub DoRowDoubleClick(ByVal view As GridView, ByVal pt As Point)
        DrillDown()
    End Sub
End Class
